#基础镜像
#FROM openjdk:8-jdk-alpine
FROM registry.cn-hangzhou.aliyuncs.com/vip-docker-com/jdk:openjdk-8-jdk-alpine
#FROM registry.cn-hangzhou.aliyuncs.com/vip-docker-com/jdk:openjdk-8-jdk-alpine-arm64

# 作者信息
MAINTAINER even

# 工作目录
WORKDIR /opt

# 环境变量
ENV APP_NAME=springboot-eureka
ENV APP_JAR=springboot-eureka.jar
ENV JAR_PATH=./target/${APP_JAR}

ENV JAVA_PORT=8080
ENV JAVA_OPTS="\
-server \
-Xmx2g \
-Xms2g \
-Xmn1g \
-XX:SurvivorRatio=8 \
-XX:MetaspaceSize=256m \
-XX:MaxMetaspaceSize=512m \
-XX:+UseParallelGC \
-XX:ParallelGCThreads=4 \
-XX:+UseParallelOldGC \
-XX:+UseAdaptiveSizePolicy \
-XX:+PrintGCDetails \
-XX:+PrintTenuringDistribution \
-XX:+PrintGCTimeStamps \
-XX:+HeapDumpOnOutOfMemoryError \
-XX:HeapDumpPath=/ \
-Xloggc:/gc.log \
-XX:+UseGCLogFileRotation \
-XX:NumberOfGCLogFiles=5 \
-XX:GCLogFileSize=10M \
"

ENV JAVA_EXT=""

# 可执行jar包复制到指定目录
ADD ${JAR_PATH} /opt/${APP_JAR}
RUN mkdir -p /opt/log/$APP_NAME
RUN chmod -R 777 /opt/log/$APP_NAME

# 暴露端口
EXPOSE ${JAVA_PORT}

# 启动应用固定命令
# ENTRYPOINT [ "java" , "${JAVA_OPTS} -jar" ]
ENTRYPOINT java ${JAVA_OPTS} ${JAVA_EXT} -jar /opt/${APP_JAR}

# 动态传递jar包名
# CMD ["application.jar"]

